﻿@model IEnumerable<OneoneNine.Models.Examine>

@*请假首页*@
@{
    ViewData["Title"] = "Index";
}

<h1>请假信息表</h1>

<p style="text-align:center">
    <a class="btn btn-outline-success" asp-action="Create">请假</a>
</p>
<h3>个人请假记录</h3>
<table class="table">
    <thead class="thead-light">
        <tr>
            <th scope="col">
                @* @Html.DisplayNameFor(model => model.StudentName)*@
                学生姓名
            </th>
            <th scope="col">
                @*@Html.DisplayNameFor(model => model.StartDate)*@
                开始日期
            </th>
            <th scope="col">
                @*@Html.DisplayNameFor(model => model.EndDate)*@
                结束日期
            </th>
            <th scope="col">
                @*@Html.DisplayNameFor(model => model.Reason)*@
                请假原因
            </th>
            <th scope="col">
                @*@Html.DisplayNameFor(model => model.State)*@
                状态
            </th>
            <th scope="col">操作</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.StudentName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.StartDate)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.EndDate)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Reason)
                </td>
                <td id="myField">
                    @Html.DisplayFor(modelItem => item.State)
                </td>
                <td>
                    @if (item.State == "驳回")
                    {
                        <a class="btn btn-outline-info" asp-action="Details" asp-route-id="@item.Id">查看</a>

                    }
                    else
                    {
                        <a class="btn btn-outline-success" asp-action="Edit" asp-route-id="@item.Id">修改</a>
                        <a class="btn btn-outline-info" asp-action="Details" asp-route-id="@item.Id">查看</a>
                    }
                    <a class="btn btn-outline-danger" asp-action="Delete" asp-route-id="@item.Id">删除</a>
                    @if (item.State == "驳回")
                    {
                        <button class="btn btn-outline-info" id="myComponent" onclick="redirectToAnotherView3('@item.Id')">查看驳回原因</button>

                    }
                    <script>
                        function redirectToAnotherView3(value1) {
                            window.location.href = "/Rejects/Details?id=" + encodeURIComponent(value1);
                        };
                    </script>
                </td>
            </tr>
        }
    </tbody>
</table>

